from sqlalchemy.dialects.mysql import INTEGER, VARCHAR,FLOAT,DOUBLE
from sqlalchemy import Column
from sqlalchemy.ext.declarative import declarative_base
from pydantic import BaseModel


Base = declarative_base()


class GroundMine(Base):
    __tablename__ = 'ground_mine'
    id = Column(INTEGER, primary_key=True)
    colliery_id = Column(INTEGER, default=0)
    setup_time = Column(INTEGER, default=0)
    name = Column(VARCHAR(255), nullable=False)
    serial_number = Column(VARCHAR(255), nullable=False)
    x = Column(FLOAT(10,9), default=0,nullable=False)
    y = Column(FLOAT(10,9), default=0,nullable=False)
    z = Column(FLOAT(10,9), default=0,nullable=False)
    modem = Column(VARCHAR(255), nullable=False)
    sensor_status = Column(VARCHAR(255), nullable=False)
    distance = Column(VARCHAR(255), nullable=False)
    create_time = Column(INTEGER, default=0)
    update_time = Column(INTEGER, default=0)


class FormBody(BaseModel):
    colliery_id:int
    serial_number:str
    modem:str
    distance:str
    x:float
    y:float
    z:float

class EditBody(BaseModel):
    mine_id:int
    serial_number:str
    modem:str
    distance:str
    x:float
    y:float
    z:float